package com.jeesite.modules.common;

import java.util.Random;

public class StringUtils {

    /**
     * StringUtils工具类方法
     * 获取一定长度的随机字符串，范围0-9，a-z
     * @param length：指定字符串长度
     * @return 一定长度的随机字符串
     */
    public static String getRandomStringByLength(int length) {
        String base = "abcdefghijklmnopqrstuvwxyz0123456789";
        Random random = new Random();
        StringBuffer sb = new StringBuffer();
        for (int i = 0; i < length; i++) {
            int number = random.nextInt(base.length());
            sb.append(base.charAt(number));
        }
        return sb.toString();
    }

    public static String getMoudleTtypeNameAndgetOperateType(Integer moudleType, Integer operateType) {
        StringBuffer str=new StringBuffer();
        if(moudleType==1){
            str.append("日记");
        }else if (moudleType==2){
            str.append("商品");

        }else if (moudleType==3){
            str.append("签到");
        }else if (moudleType==4){
            str.append("购买");
        }

        if(operateType==1){
            str.append("发布");
        }else if (operateType==2){
            str.append("转发");

        }else if (operateType==3){
            str.append("点赞");

        }else if (operateType==4){
            str.append("签到");

        }else if (operateType==5){
            str.append("7天签到");

        }else if (operateType==6){
            str.append("15天签到");

        }else if (operateType==7){
            str.append("25天签到");

        }else if (operateType==8){
            str.append("消费");

        }
        return str.toString();

    }
}
